package me.trytofeel.mapper;

import me.trytofeel.bean.Video;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

public interface VideoMapper {
    @Insert("insert into mybatis.video (video_title) values (#{videoTitle});")
    int insertVideo(Video video);

    @Delete("delete from mybatis.video where video_id = #{id};")
    int deleteVideoById(int id);

    @Update("update mybatis.video set video_title = #{videoTitle} where video_id = #{videoId};")
    int updateVideo(Video video);

    @Select("select video_id videoId, video_title videoTitle from mybatis.video;")
    List<Video> selectAllVideos();

    @Select("select video_id videoId, video_title videoTitle from mybatis.video where video_id = #{id};")
    Video selectVideoById(int id);
}
